﻿//  Copyright (c) 2011 Ray Liang (http://www.dotnetage.com)
//  Licensed MIT: http://www.opensource.org/licenses/mit-license.php

namespace DNA.Mvc
{
    /// <summary>
    /// Defines Repository methods to manipulate the Subscription data object.
    /// </summary>
    public interface ISubscriptionRepository : IRepository<Subscription> 
    {
        /// <summary>
        /// Remove the user from subscription list.
        /// </summary>
        /// <param name="token">Specified the subscription list token.</param>
        /// <param name="userName">Specified the user name who to unsubscribe.</param>
        void Unsubscribe(string token, string userName);

        /// <summary>
        /// Add user to the subscription list.
        /// </summary>
        /// <param name="token">Specified the subscription list token.</param>
        /// <param name="userName">Specified the user name who to subscribe.</param>
        /// <returns>Returns true when added user to subscription list.</returns>
        bool Subscribe(string token, string userName);

        /// <summary>
        /// Gets/Sets whether the user is in the subscription list.
        /// </summary>
        /// <param name="token">Specified the subscription list token.</param>
        /// <param name="userName">Specified the user name who to subscribe.</param>
        /// <returns>Returns true when user is in subscription list.</returns>
        bool IsSubscribed(string token, string userName);

        /// <summary>
        /// Gets a subscription list by specified token.
        /// </summary>
        /// <param name="token">Specified the subscription list token.</param>
        /// <returns>Returns user name arrary.</returns>
        string[] GetSubscribers(string token);
    }
}
